DEFINITION FOR C MODULE Clipboard ;

FROM SYSTEM	IMPORT STRING, SHORTSET ;
FROM Exec	IMPORT CMD_NONSTD, Message, DevicePtr, Node ;

CONST
  CBD_POST		= CMD_NONSTD+0 ;
  CBD_CURRENTREADID	= CMD_NONSTD+1 ;
  CBD_CURRENTWRITEID	= CMD_NONSTD+2 ;
  CBD_CHANGEHOOK	= CMD_NONSTD+3 ;

  CBERR_OBSOLETEID = 1 ;

TYPE
  ClipboardUnitPartialPtr = POINTER TO ClipboardUnitPartial ;
  IOClipReqPtr		  = POINTER TO IOClipReq ;
  SatisfyMsgPtr		  = POINTER TO SatisfyMsg ;
  ClipHookMsgPtr	  = POINTER TO ClipHookMsg ;

  ClipboardUnitPartial = RECORD
    cu_Node    : Node    ; (* list of units		*)
    cu_UnitNum : LONGINT ; (* unit number for this unit *)
    (* the remaining unit data is private to the device *)
  END ;

  IOClipReq = RECORD
    io_Message : Message ;
    io_Device  : DevicePtr ;		   (* device node pointer	      *)
    io_Unit    : ClipboardUnitPartialPtr ; (* unit node pointer		      *)
    io_Command : CARDINAL ;		   (* device command		      *)
    io_Flags   : SHORTSET ;		   (* including QUICK and SATISFY     *)
    io_Error   : SHORTINT ;		   (* error or warning num	      *)
    io_Actual  : LONGINT  ;		   (* number of bytes transferred     *)
    io_Length  : LONGINT  ;		   (* number of bytes requested	      *)
    io_Data    : STRING   ;		   (* either clip stream or post port *)
    io_Offset  : LONGINT  ;		   (* offset in clip stream	      *)
    io_ClipID  : LONGINT  ;		   (* ordinal clip identifier	      *)
  END ;

CONST
  PRIMARY_CLIP = 0 ;	(* primary clip unit *)

TYPE
  SatisfyMsg = RECORD
    sm_Msg    : Message  ; (* the length will be 6	      *)
    sm_Unit   : CARDINAL ; (* which clip unit this is	      *)
    sm_ClipID : LONGINT  ; (* the clip identifier of the post *)
  END ;

  ClipHookMsg = RECORD
    chm_Type	  : LONGINT ; (* zero for this structure format		     *)
    chm_ChangeCmd : LONGINT ; (* command that caused this hook invocation:   *)
			      (*   either CMD_UPDATE or CBD_POST	     *)
    chm_ClipID	  : LONGINT ; (* the clip identifier of the new data	     *)
  END ;

END Clipboard.
